-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[MXNET-766] add unroll RNN for HybridBlock #11948
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
It will be great to have some perf results to decide if we want to use unroll with foreach for models in gluonnlp |
@szha could you also review? |
@szha bouncing again for your review. |
|
||
|
||
def _contrib_format_sequence(inputs, layout, in_layout=None): | ||
assert inputs is not None, \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be feasible to reuse rnn_cell._format_sequence?
|
||
|
||
def unroll(cell, inputs, begin_state, drop_inputs=0, drop_outputs=0, | ||
layout='TNC', valid_length=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This interface is not consistent with existing unrolls in that merge_outputs is not supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that if merge_outputs is false, we have to know the length of the sequence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest renaming
Looks like feedback addressed and ready for merge, @szha kindly review. |
@szha @sandeep-krishnamurthy for review |
@zheng-da - What is the next step here? |
i don't think this PR will be merged. I'll close it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you fix the conflict?
* add contrib unroll. * reenable some tests. * fix a bug. * fix lint. * fix a bug. * support diff layouts. * update doc. * use a diff default layout. * remove _contrib_format_sequence. * fix lint. * rename.
* add contrib unroll. * reenable some tests. * fix a bug. * fix lint. * fix a bug. * support diff layouts. * update doc. * use a diff default layout. * remove _contrib_format_sequence. * fix lint. * rename.
* add contrib unroll. * reenable some tests. * fix a bug. * fix lint. * fix a bug. * support diff layouts. * update doc. * use a diff default layout. * remove _contrib_format_sequence. * fix lint. * rename.
* add contrib unroll. * reenable some tests. * fix a bug. * fix lint. * fix a bug. * support diff layouts. * update doc. * use a diff default layout. * remove _contrib_format_sequence. * fix lint. * rename.
* add contrib unroll. * reenable some tests. * fix a bug. * fix lint. * fix a bug. * support diff layouts. * update doc. * use a diff default layout. * remove _contrib_format_sequence. * fix lint. * rename.
Description
Currently, Gluon RNNCell unroll can't be used in Gluon HybridBlock. This unroll function works with an RNN cell and can be used in any HybridBlock.
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments